<?php

/**
 * 控制器超类<p/>
 * @catepory【框架核心】控制器超类
 * @author zhouhaichao(a)2008.sina.com
 * @version 1.0
 * @copyright (c) 2008
 * @date 2013-2-21
 */
class Controller
{

    protected $request;

    public function __construct(Request $request)
    {
        $this->request = $request;
        $this->init();
    }

    /**
     * 初始化参数
     */
    public function init()
    {
    }

    /**
     * 重定向方法
     * @param $method
     * @param array $params
     * @return mixed
     * @throws Exception
     */
    public function _remap($method, $params = array())
    {
        if (method_exists($this, $method)) {
            return call_user_func_array(array($this, $method), $params);
        } else {
            throw new Exception("the Method named $method is not found !");
        }
    }
}